#include<stdio.h>
//运用自定义函数实现调换a，b的值

/*1.错误写法
int replace(int x,int y)
{
	int z = 0;
	z = x;
	x = y;
	y = z;
}*/

//2.正确写法-使用指针进行取地址
int replace(int *xp,int *yp)
{
	int z = 0;
	z = *xp;
	*xp = *yp;
	*yp = z;
}

int main()
{
    int a = 0;
    int b = 0;
	scanf("%d %d",&a,&b);
	printf("替换之前：a=%d;b=%d\n",a,b);
	
    //自定义函数
	replace(&a,&b);
	printf("替换之后：a=%d;b=%d\n",a,b);
	
	return 0;
}
